<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>校区课程表</title>
    <link rel="stylesheet" href="/css/step2-beijing.css" />
    <script src="/js/jquery.min.js"></script>
<!--     <script src="../js/choose-object.js"></script> -->
	<script type="text/javascript">
		
	$(function () {
		
		$("input[type='checkbox']").click(function(){
			
			if(this.checked || this.checked=='checked'){
				$("."+$(this).attr("class")+"").removeAttr("checked");
	            $(this).prop("checked", true);
	        }
			
		});
		
	})
		var submitChoise = function(){
			
			var courseIds = ""
			
			$("[name='courseArrangeId']:checked").each(function(){
				
				courseIds += $(this).val() + ",";
			})
			courseIds=(courseIds.substring(courseIds.length-1)==',')?courseIds.substring(0,courseIds.length-1):courseIds;
			
			$.ajax({
				
				url:"/course/validate/"+courseIds,
				type:"post",
				dataType:"json",
				success:function(data){
					if(!data.result){
						alert(data.msg);
					}
				}
			});
			
			window.location.href="/course/submitCourse?arrangIds="+courseIds;
			
		}
	</script>
</head>
<body>
<div class="timetable-box">
    <div class="school-flows">
        <div class="school-f-1">第一步：选择校区</div>
        <div class="school-f-2">第二步：选择课程</div>
        <div class="school-f-3">第三步：确认订单</div>
        <div class="school-f-4">第四步：支付订单</div>
    </div>
    <form action="" method="" id="tt-step2">
        <table class="syllabus">
            <tbody>
            <tr>
                <th width='25%'>时间</th>
                <th width='30%'>课程名称</th>
                <th width='30%'>授课老师</th>
                <th width='15%'>选择</th>
            </tr>
            <!--早上第一节开始-->
			
			<tr th:each="courseList,listStat:${courseMap}">
				<td th:text="${courseList.key}"></td>
				<td colspan='3'>
					<table style="width:100%">
						<tr th:each="course : ${courseList.value}">
			                <td width='40%' style='border-style:none;text-align: center;vertical-align: middle;padding-top: 10px;padding-bottom: 10px' >
			                	<span th:text="${course.courseName }"></span>
			                	<br/>
			                	<span th:text="${course.courseCode }"></span>
			                </td>
			                <td width='40%' style='border-style:none;text-align: center;vertical-align: middle;padding-top: 10px;padding-bottom: 10px'>
			                	<span th:text="${course.teacherFirstName }"></span>&nbsp;
			                	<span th:text="${course.teacherLastName }"></span>
			                	<br/>
			                	<span th:text="${course.teacherSchoolName }"></span>
			                </td>
			                <td width='20%' style='border-style:none;text-align: center;vertical-align: middle;padding-top: 10px;padding-bottom: 10px'>
			                    <input class="bj_mornig-1" type="checkbox" data-amount="0.00" name="courseArrangeId"  th:attr="value=${course.courseArrangeId},class=${course.courseClass}" />
			                </td>
						</tr>
					</table>
				</td>
			</tr>

            </tbody>
        </table>

        <div class="xian-next">
            <a href="javascript:submitChoise()">下一步>></a>
        </div>
    </form>

</div>

</body>
</html>